﻿using Microsoft.VisualBasic.ApplicationServices;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Security.Cryptography.Xml;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Vlc.DotNet.Forms;

namespace 水下机器人操作系统
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
        }

        private void txtPort_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar))
            {
                e.Handled = true;
            }
        }

        private void btnConnect_Click(object sender, EventArgs e)
        {
            if (txtAddress.Text == "")
            {
                MessageBox.Show("请输入服务器地址");
            }
            else if (txtPort.Text == "")
            {
                MessageBox.Show("请输入端口");
            }
            else
            {
                Constants.myClient.Connect(txtAddress.Text, Convert.ToInt32(txtPort.Text));
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void vlcCtrl_VlcLibDirectoryNeeded(object sender, VlcLibDirectoryNeededEventArgs e)
        {
            e.VlcLibDirectory = new DirectoryInfo(Path.Combine(Environment.CurrentDirectory, "vlc", Environment.Is64BitProcess ? "x64" : "x86"));
        }

        private void btnCtrl_Click(object sender, EventArgs e)
        {
            Constants.ctrlForm.Show();
        }
    }
}
